package com.igeek.javase.ch02;

/*
 *@author wangpeng
 *2023/7/11 22:51
 *@description TODO
 */
public class Car {
    private String brand;//品牌
    private String carmodel;//车型
    private float price;//价格

    //无参构造
    public Car() {
        this.brand = "沃尔沃";
        this.carmodel = "越野车";
        this.price = 800000;
    }
    //有参构造
    public Car(String brand,String carmodel, float price) {
        this.brand = brand;
        this.carmodel = carmodel;
        this.price  = price;
    }
    public void show(){
        System.out.println("这是汽车的信息介绍：" +"品牌："+ brand +" 车型："+carmodel+" 价格"+price);
    }

}
class Test{
    public static void main(String[] args) {
        Car car1 = new Car();
        car1.show();
        Car car2 = new Car("比亚迪","SUV",900000);
        car2.show();
    }
}

